package main

import (
	k8sClientSet "k8s.io/client-go/kubernetes"
	"k8s.io/client-go/tools/clientcmd"
	"k8s.io/klog/v2"
)

func main() {
	// Load kubeconfig
	config, err := clientcmd.BuildConfigFromFlags("", clientcmd.RecommendedHomeFile)
	if err != nil {
		panic(err)
	}

	// Create clientset
	clientset, err := k8sClientSet.NewForConfig(config)
	if err != nil {
		panic(err)
	}
	// Start informer
	stopCh := make(chan struct{})

	runPodController(clientset, stopCh)
	go runOrderController(clientset, config, stopCh)
	go runProductController(clientset, config, stopCh)

	// Run forever
	<-stopCh
}

var (
	ctx    = SetupSignalHandler()
	logger = klog.FromContext(ctx)
)
